﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace demo3
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            string _resName = Assembly.GetExecutingAssembly().GetName().Name + ".Lib." + new AssemblyName(args.Name).Name + ".dll";            using (var _stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(_resName))            {                byte[] _data = new byte[_stream.Length];                _stream.Read(_data, 0, _data.Length);                return Assembly.Load(_data);            }
        }
    }
}
